import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

public class Demo30 {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<Integer> queue = new LinkedBlockingQueue<>(2);
        queue.put(1);
        System.out.println("添加一个元素");
        queue.put(2);
         System.out.println("添加一个元素");
        queue.put(3);
        System.out.println("添加一个元素");
        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println(queue.take());
    }

}
